package com.example.springboot.mapper;

import com.example.springboot.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;
@Component
@Mapper
public interface UserMapper {
    @Select("select * from user where status = 1")
    User findUserIdOnLine();

    @Select("select * from user where id = #{id}")
    User findUserById(int id);

    @Select("select * from user where username = #{name}")
    User findUserByUserName(String name);

    @Insert("insert into user (username,password,createtime) values (#{username},#{password},#{createtime})")
    int insertUserInfo(User user);

    @Update("update user set status = 1 where id = #{id}")
    int updateStatus(int id);
}
